#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Realization.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Classifier;

/// <summary>
/// Substitution
/// A substitution is a relationship between two classifiers signifying that the
/// substituting classifier complies with the contract specified by the contract
/// classifier. This implies that instances of the substituting classifier are
/// runtime substitutable where instances of the contract classifier are expected.
/// </summary>
class UMLMODEL_EXPORT Substitution : public Realization {

public: // Constructors and destructors
    explicit Substitution(const QString& umlType="uml::Substitution");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// contract getter
    /// The contract with which the substituting classifier complies.
    /// </summary>
    shared_ptr<Classifier> contract() const;

    /// <summary>
    /// contract setter
    /// The contract with which the substituting classifier complies.
    /// </summary>
    void setContract(shared_ptr<Classifier> value);

    /// <summary>
    /// substitutingClassifier getter
    /// Instances of the substituting classifier are runtime substitutable where
    /// instances of the contract classifier are expected.
    /// </summary>
    shared_ptr<Classifier> substitutingClassifier() const;

    /// <summary>
    /// substitutingClassifier setter
    /// Instances of the substituting classifier are runtime substitutable where
    /// instances of the contract classifier are expected.
    /// </summary>
    void setSubstitutingClassifier(shared_ptr<Classifier> value);

private: // Fields
    /// <summary>
    /// contract
    /// The contract with which the substituting classifier complies.
    /// </summary>
    shared_ptr<Classifier> contract_;

    /// <summary>
    /// substitutingClassifier
    /// Instances of the substituting classifier are runtime substitutable where
    /// instances of the contract classifier are expected.
    /// </summary>
    shared_ptr<Classifier> substitutingClassifier_;

};

} // namespace uml
